﻿using KWT.DRG_DIP.Common;
using KWT.DRG_DIP.DO.System;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KWT.DRG_DIP.PO.Basic
{
    /// <summary>
    /// 系统用户
    /// </summary>
    [Index(nameof(LoginName))]
    public class Sys_User : Audit
    {
        /// <summary>
        /// 主键
        /// </summary>
        [Key]
        [Required]

        public string UserID { get; set; }
        /// <summary>
        /// 租户ID
        /// </summary>
        public string TenantID { get; set; }
        /// <summary>
        /// 角色外键
        /// </summary>

        public string RoleID { get; set; } = "-1";

        /// <summary>
        /// 微信openid
        /// </summary>
        public string WxOpenID { get; set; }
        /// <summary>
        /// 微信unionid
        /// </summary>
        public string WxUnionID { get; set; }
        /// <summary>
        /// 余额
        /// </summary>
        public int Balance { get; set; }
        /// <summary>
        /// 登录名
        /// </summary>

        public string LoginName { get; set; }
        /// <summary>
        /// 昵称
        /// </summary>

        public string NickName { get; set; }
        /// <summary>
        /// 头像
        /// </summary>
        public string Avatar { get; set; }
        /// <summary>
        /// 手机号
        /// </summary>
        [StringLength(11)]
        public string Phone { get; set; }
        /// <summary>
        /// 真实名称
        /// </summary>

        public string RealName { get; set; }
        /// <summary>
        /// 年龄
        /// </summary>
        public int Age { get; set; }
        /// <summary>
        /// 备注
        /// </summary>

        public string Desc { get; set; }
        /// <summary>
        /// 盐值
        /// </summary>
        public string Salt { get; set; } = _Tool.RandomString(8);
        /// <summary>
        /// 密码
        /// </summary>

        public string Pwd { get; set; }
        /// <summary>
        /// 状态
        /// </summary>
        public int Status { get; set; } = 1;
        /// <summary>
        /// 登录时间
        /// </summary>
        public DateTime? LastLoginTime { get; set; }
        /// <summary>
        /// 登录失败次数
        /// </summary>
        public int FailedCount { get; set; }

        /// <summary>
        /// 会员时间
        /// </summary>
        public DateTime? VipTime { get; set; }
    }
}
